<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>京东商品信息</title>
		<script src="js/jquery.min.js"></script>
		<style>
			body {
				background-color: #d0e4fe;
				background-image: linear-gradient(to right, rgba(170, 255, 255, 0.0), rgba(255, 255, 255, 1.0));
			}
		</style>

	</head>

	<body>
		<div>
			商品编号：<span id="id"></span>
		</div>

		<div>
			商品价格：<span id="price"></span>
		</div>


	</body>
	<script>
		//写死字符串
		var jsonstr = '[{"p":"17999.00","op":"17999.00","cbf":"0","id":"J_100010378153","m":"100000.00"}]'
		var obj = JSON.parse(jsonstr); //把字符串转换成对象,数组


		//发起ajax请求
		$.ajax({
			type: "get",
			url: "https://p.3.cn/prices/mgets?skuIds=J_100010378153",
			dataType: "jsonp",
			success: function(data) {
				console.log(data);
				var obj = data;
				var price = obj[0].p;
				var id = obj[0].id;

				// console.log(price);
				// console.log(id);

				$("#id").text(id);
				$("#id").css("color", "blue");

				$("#price").text(price).css("color", "red").css("font-weight", "bold");

			}
		});
	</script>
</html>
